<?php
/**
 * Created by PhpStorm.
 * FileName: AirwayController.class.php
 * User: Administrator
 * Date: 2018/9/11
 * Time: 16:59
 */

namespace Admin\Controller;

use Admin\Controller\AdminController;
use Admin\Model\ConfigModel;

/**
 * Class AirwayController
 * @package Admin\Controller
 * @todo 系统配置模块
 * @menu 系统配置
 * @author fanyuliang
 * @menuAuto index
 * @order 505
 * @icon article.png
 */
class SysSettingController extends AdminController {

    private $configModel;

    function __construct() {
        parent::__construct();
        $this->configModel = new ConfigModel();
    }

    /**
     * @todo 系统配置
     * @menu 系统配置
     * @order 1
     */
    public function index() {
        $this->setForm();
        $where = array();
        $data = $this->configModel->getList($where);
        $this->setPageData($data);
        $this->display();
    }

    public function set() {
        $response = array('status' => false, 'msg' => '配置项保存失败!');
        $rs = $this->configModel->add($_POST);
        if ($rs !== false) {
            $response['status'] = true;
            $response['msg'] = '配置项保存成功!';
        }
        $this->ajaxReturn($response);
    }
}